from django.http import JsonResponse

result_error = {
    'code': '',
    'msg': ''
}
result_success = {
    'code': '',
    'msg': '',
    'data': ''
}


def resultError(code, msg):
    result_error['code'] = code
    result_error['msg'] = msg
    return JsonResponse(result_error)


def resultSuccess(code, msg, data=None):
    if data is None:
        data = {}
    result_success['code'] = code
    result_success['msg'] = msg
    result_success['data'] = data
    return JsonResponse(result_success)
